package com.kkb.service.impl;

import com.kkb.mapper.TbBusinessMapper;
import com.kkb.pojo.TbBusiness;
import com.kkb.pojo.TbBusinessExample;
import com.kkb.service.TbBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TbBusinessServiceImpl   implements TbBusinessService {
    @Autowired
    private  TbBusinessMapper tbBusinessMapper;


    @Override
    public List<TbBusiness> getCommodity() {
        TbBusinessExample example = new TbBusinessExample();
        List<TbBusiness> tbBusinesses = tbBusinessMapper.selectByExample(example);
        return tbBusinesses;
    }

    @Override
    public int insertTbBusiness(TbBusiness tbBusiness) {
        return tbBusinessMapper.insert(tbBusiness);
    }

    @Override
    public int deleteCommodityById(Integer businessId) {
        return (int)tbBusinessMapper.deleteByPrimaryKey(businessId);
    }

    @Override
    public int editCommodityById(Integer businessId) {
        return 0;
    }

    @Override
    public TbBusiness SelectCommodityById(Integer businessId) {
        return tbBusinessMapper.selectByPrimaryKey(businessId);
    }

    @Override
    public int updateCommodity(TbBusiness tbBusiness) {
        return tbBusinessMapper.updateByPrimaryKeySelective(tbBusiness);
    }


}
